﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Dev.Control;
using EDI_DLL;
using EDI.forms;
using EDI_DLL.Import;

namespace Sfcorp.form
{
    public partial class frmAccountCZ : BaseFormDev
    {
        etyEdiSetting eyImpXlsSett;
        bizEDI bzEDI;

        public frmAccountCZ()
        {
            InitializeComponent();
            this.Load+=new EventHandler(frmAccountCZ_Load);
        }


            //        string sGridHead = "[CLIENT_COD;客户代码],[CLIENT_NAME;客户名称],[MONTH_ID;帐单月份],[BILL_CONFIRM_DT;码头确帐时间],[RECORD_DT;办单日期],[WORK_WAY_NAM;作业方式],[SERVICE_NO;服务单],[PREBAL_ID;预结号],[BILL_NO;海运提单号],[ORIGINAL_BILL_NO;原始提单号],[CARGO_NAM;货名],[C_SHIP_NAM;船名],[VOYAGE;航次],[TO_PORT_TIM;船到港时间],[LEAV_PORT_TIM;船离港时间],[CONTRACT_NO;委托号],[I_E_NAM;进出口],[TRANS_COUNTER;含中转数],[S20E_COUNTER;20\'E],[S20F_COUNTER;20\'F],[S40E_COUNTER;40\'E],[S40F_COUNTER;40\'F],[S45E_COUNTER;45\'E],[S45F_COUNTER;45\'F],[SOTHERE_COUNTER;其他柜型E],[SOTHERF_COUNTER;其他柜型F],[DANG_COUNTER;含危],[FEE_SUMMNY;港口费用合计],[FEE_SHIP_WORK;装卸船费],[FEE_SHIP_ANCHOR;停泊费],[FEE_FRUNK_WRAPIG;包干费],[FEE_SET_SEAL;加封费],[FEE_WORK_COST;工本费],[FEE_CNTR_E_CY;吉箱堆存费],[FEE_CNTR_F_CY;重箱堆存费],[FEE_CARGO_CY;散堆存费],[FEE_OTHER;其他费用],[FEE_RETURN;退费金额],[RE_MARK;备注],[GKEY;GKEY],[DOWNLOAD_TIM;下载时间]";
            //ggcCzAccount.ColumnsMappingCreate(sGridHead);
            //bzEDI = new bizEDI(global.basSysPara.SqlHelp);

        private void btnImport_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                if(bzEDI==null)
                    bzEDI = new bizEDI(global.basSysPara.SqlHelp);
                if (eyImpXlsSett == null)
                {
                    eyImpXlsSett = new etyEdiSetting();
                    eyImpXlsSett = bzEDI.GetEdiSettAsEdiName("CZ_ACCOUNT");
                }

                frmImport fmImp = new frmImport(ref eyImpXlsSett);
                if (fmImp.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    eyImpXlsSett.RUN_TIME = "";
                    eyImpXlsSett.LST_MOD = DateTime.Now.ToString("yyMMddHHmmss") + DateTime.Now.Millisecond.ToString();
                    eyImpXlsSett.LST_USER = global.basSysPara.UserID;
                    eyImpXlsSett.EDI_TYPE = "EXCELTABLE";

                    impThread _impThread = new impThread(eyImpXlsSett, global.basSysPara.SqlHelp, null);     //建立线程
                }
            }
            catch(Exception ex) {
                TT.HelpInfo.MsgBox.ShowWarnBox("导入失败"+ex.ToString());
            }
        }

        private void frmAccountCZ_Load(object sender, EventArgs e)
        {
            string sGridHead = "[CLIENT_COD;客户代码],[CLIENT_NAME;客户名称],[MONTH_ID;帐单月份],[BILL_CONFIRM_DT;码头确帐时间],[RECORD_DT;办单日期],[WORK_WAY_NAM;作业方式],[SERVICE_NO;服务单],[PREBAL_ID;预结号],[BILL_NO;海运提单号],[ORIGINAL_BILL_NO;原始提单号],[CARGO_NAM;货名],[C_SHIP_NAM;船名],[VOYAGE;航次],[TO_PORT_TIM;船到港时间],[LEAV_PORT_TIM;船离港时间],[CONTRACT_NO;委托号],[I_E_NAM;进出口],[TRANS_COUNTER;含中转数],[S20E_COUNTER;20\'E],[S20F_COUNTER;20\'F],[S40E_COUNTER;40\'E],[S40F_COUNTER;40\'F],[S45E_COUNTER;45\'E],[S45F_COUNTER;45\'F],[SOTHERE_COUNTER;其他柜型E],[SOTHERF_COUNTER;其他柜型F],[DANG_COUNTER;含危],[FEE_SUMMNY;港口费用合计],[FEE_SHIP_WORK;装卸船费],[FEE_SHIP_ANCHOR;停泊费],[FEE_FRUNK_WRAPIG;包干费],[FEE_SET_SEAL;加封费],[FEE_WORK_COST;工本费],[FEE_CNTR_E_CY;吉箱堆存费],[FEE_CNTR_F_CY;重箱堆存费],[FEE_CARGO_CY;散堆存费],[FEE_OTHER;其他费用],[FEE_RETURN;退费金额],[RE_MARK;备注],[GKEY;GKEY],[DOWNLOAD_TIM;下载时间]";
            ggcCzAccount.ColumnsMappingCreate(sGridHead);
        }
    }
}
